import request from '@/utils/request'

/**
 * 获取前十论坛
 */
 export function getTopPosts(){
  return request({
    url:'talks/list?hot=0&size=6',
    method:'GET'
  })
}

/**
 *分页获取最近发布
 * @param {页码参数} params
 * @returns
 */
export function getLatest(){
  return request({
    url:'/talks/latest?page=1&size=5',
    method:'GET'
  })
}

/**
 * 获取推荐的帖子
 * @returns
 */
export function getRecommend(){
  return request({
    url:'/talks/recommend',
    method:"GET"
  })
}

/**
 * 获取指定论坛的详细信息
 * @param {论坛ID} talkId
 * @returns
 */
export function getTalkDetail(talkId){
  return request({
    url:'/talks/talk/'+talkId,
    method:"GET"
  })
}

/**
 *
 * @param {论坛ID} talkId
 * @returns
 */
export function getPostByTalk(talkId){
  return request({
      url:'talks/posts/list?page=1&size=1000&talkId='+talkId,
      method:'GET'
  })
}

/**
 * 获取指定论坛的热门帖子
 * @param {论坛ID} talkId
 * @returns
 */
export function getHotPostBtTalk(talkId){
  return request({
    url:'talks/hotPost/'+talkId,
    method:'GET'
  })
}

export default{
  getTopPosts,
  getLatest,
  getRecommend,
  getTalkDetail,
  getPostByTalk,
  getHotPostBtTalk
}
